/**
 * 
 */
package metalink.admin;

import java.util.ArrayList;

import vo.LibraryBookDetailsVo;
import model.admin.LibraryMo;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author Sony
 *
 */
public class EditBook extends ActionSupport{
	String edit="";
	int book_id;
	String book_id1;
	String author_name;
	String book_name;
	String category;
	String price;
	int count;
	String publisher;
	String referred_by;
	String description;
	ArrayList<LibraryBookDetailsVo> list;
	ArrayList<LibraryBookDetailsVo> bookCategories;
public String execute()
{
	if(edit.equals("edit"))
	{
		
		//System.out.println("came here..");
		list=new ArrayList<LibraryBookDetailsVo>();
		LibraryMo mo=new LibraryMo();
		LibraryMo mo1=new LibraryMo();
		list=mo.edit(book_id);
		bookCategories=new ArrayList<LibraryBookDetailsVo>();
		bookCategories=mo1.getCategories();
		//LibraryBookDetailsVo vo=new LibraryBookDetailsVo();
		return SUCCESS;	
	}

	else if(edit.equals("submit"))
	{
		System.out.println("entered submit book_id="+book_id);
		LibraryBookDetailsVo vo=new LibraryBookDetailsVo();
		vo.setBook_id(book_id);
		vo.setAuthor_name(author_name);
		vo.setBook_name(book_name);
		vo.setPrice(Integer.parseInt(price));
		vo.setCategory(category);
		vo.setDescription(description);
		vo.setPublisher(publisher);
		vo.setReferred_by(referred_by);
		LibraryMo mo=new LibraryMo();
		mo.submit(vo);
		addActionError("Book edited successfully..");
		System.out.println("out of submit");
		return "edited";
	}
	return ERROR;
}
public String getEdit() {
	return edit;
}
public void setEdit(String edit) {
	this.edit = edit;
}
public int getBook_id() {
	return book_id;
}
public void setBook_id(int book_id) {
	this.book_id = book_id;
}
public String getAuthor_name() {
	return author_name;
}
public void setAuthor_name(String author_name) {
	this.author_name = author_name;
}
public String getBook_name() {
	return book_name;
}
public void setBook_name(String book_name) {
	this.book_name = book_name;
}
public String getBook_id1() {
	return book_id1;
}
public void setBook_id1(String book_id1) {
	this.book_id1 = book_id1;
}
public String getCategory() {
	return category;
}
public void setCategory(String category) {
	this.category = category;
}
public String getPrice() {
	return price;
}
public void setPrice(String price) {
	this.price = price;
}
public int getCount() {
	return count;
}
public void setCount(int count) {
	this.count = count;
}
public String getPublisher() {
	return publisher;
}
public void setPublisher(String publisher) {
	this.publisher = publisher;
}
public String getReferred_by() {
	return referred_by;
}
public void setReferred_by(String referred_by) {
	this.referred_by = referred_by;
}
public String getDescription() {
	return description;
}
public void setDescription(String description) {
	this.description = description;
}
public ArrayList<LibraryBookDetailsVo> getList() {
	return list;
}
public void setList(ArrayList<LibraryBookDetailsVo> list) {
	this.list = list;
}
public ArrayList<LibraryBookDetailsVo> getBookCategories() {
	return bookCategories;
}
public void setBookCategories(ArrayList<LibraryBookDetailsVo> bookCategories) {
	this.bookCategories = bookCategories;
}

}
